package tuanvn.iti.vn;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import mrtran.iti.vn.Main;
import mrtran.iti.vn.R;
import mrtran.iti.vn.Main.GameView;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;

public class SpriteKimCuong3 {
	private GameView gameView;
	private Bitmap bmp;
	private int  width,height;
	public static int  yKimCuong3=(int) (Main.SCREENHEIGHT/1.8);
	public static int xKimCuong3;	
	public static int widthLuffyKimCuong3,KimCuongWidth3;	
	public static int xKimCuongCenter3,yKimCuongCenter3;	
	public static int distanceKimCuong3;
	private List<SpriteKimCuong3> spriteKimCuong3;
		
	public SpriteKimCuong3(GameView gameView2, Bitmap bmp,List<SpriteKimCuong3> spriteKimCuong3,int xKimCuong4, int yKimCuong4) {
		this.gameView = gameView2;
		this.bmp = bmp;
		this.height=bmp.getHeight();
		this.width=bmp.getWidth();	
		this.xKimCuong3= xKimCuong3;
		this.yKimCuong3=yKimCuong3;
		Random rnd = new Random();
		xKimCuong3 = rnd.nextInt(gameView.getWidth()-width);
		this.spriteKimCuong3 = spriteKimCuong3;
	}

	private void update() {
		if (distanceKimCuong3 < widthLuffyKimCuong3) {
			Main.jewel = Main.jewel + 1;
			spriteKimCuong3.remove(this);
			
			}	

		xKimCuongCenter3 = (int) (xKimCuong3+width/2);
		yKimCuongCenter3 = (int) (yKimCuong3+height/2);
		KimCuongWidth3= width/2;
	}

	

	public void onDraw(Canvas canvas) {
		update();
		canvas.drawBitmap(bmp, xKimCuong3, yKimCuong3, null);
	}
	
}
